#version 330 core
uniform mat4 u_Matrix;
uniform float u_CurrentTime;

attribute vec3 a_Position;
attribute vec3 a_Color;
attribute vec3 a_Direction;
attribute float a_StartTime;

varying vec3 v_Color;
varying float v_ElapsedTime;

void main(void) {
    v_Color = a_Color;
    v_ElapsedTime = u_CurrentTime - a_StartTime;
    vec3 currentPosition = a_Position + a_Direction * v_ElapsedTime; 
    float gravityFactory = v_ElapsedTime * v_ElapsedTime / 20.0;
    currentPosition.y -= gravityFactory;
    gl_Position = u_Matrix * vec4(currentPosition, 1.0f);
    gl_PointSize = 25.0;
}
